{{template "base/base.html" .}}
{{define "head"}}
        <title>业务管理</title>
{{end}}
{{define "content"}}
    <!-- 主面板Content -->
<link href="/static/assets/select2-3.5.2/select2.css" rel="stylesheet">
<style>
    td{position: relative;}
    .copy-btn{position: absolute;top: 13px;right: 8px;visibility: hidden;z-index: 8888;}
    td:hover .copy-btn,.copy-btn.hover{display:inline;visibility: visible;}
</style>
<div class="content-wrapper">
    <!-- 主面板 Header  -->
    <section class="content-header">
        <h1>业务查询</h1>
                <a id="newapp" class="btn btn-success" href="/app/newapp" style="position:absolute;right:20px;top:20px;"><span class="fa fa-plus pr10"></span>新增业务</a>
            </section>
    <!-- 主面板 Main-->
    <section class="content" id="searcBusiness">

        <table id="grid" style="opacity:0">
            <colgroup>
                <col style="width:15%"/>
                <col style="width:25%" />
                <col style="width:15%"/>
                <col />
                <col />
                <col style="width:10%"/>
            </colgroup>
            <thead>
            <tr>
                <th data-field="make"><span id="appname">业务名称</span></th>
                <th data-field="model"><span id='maintainers'>运维人员</span></th>
                <th data-field="year">创建人</th>
                <th data-field="category">创建时间</th>
                <th data-field="airconditioner">是否游戏</th>
                <th data-field="hostnum">主机个数</th>
                <th data-field="aircondition"><div class='limit-width'>操作</div></th>
            </tr>
            </thead>
                <tbody>
                    {{range $index, $elem := .apps}}
                    <tr>
                        <td><div class="business_name" title="dd">{{$elem.ApplicationName}}</div>
                            <input type="hidden" class="ApplicationID" value="{{$elem.Id}}">
                            <input type="hidden" class="ApplicationName" value="{{$elem.ApplicationName}}">
                        </td>
                        <td><div class="operaer" title="1842605324">1842605324</div>
                            <input type="hidden" class="Maintainers" value="1842605324">
                            <span class='btn btn-default btn-xs copy-btn'>复制</span>
                        </td>
                        <td>1842605324</td>
                        <td>2016-03-14 </td>
                        <td>是</td>
                        <td>0</td>
                        <td style="text-align: center;" role="gridcell">
                            <a name="edits" class="btn btn-success  btn-sm c-searchyw-edit" >编辑</a>
                            <a name="cancels"  class="btn btn-default btn-sm c-searchyw-cancel" href="javascript:void(0)">取消</a>
                            <a name="saves" style="display:none" class="btn btn-primary btn-sm c-searchyw-save"  >保存</a>
                            <a name="deletes"  class="btn btn-danger btn-sm c-searchyw-delete" href="javascript:void(0)">删除</a>
                        </td>
                    </tr>
                    {{end}}
                </tbody>
        </table>
    </section>
</div>
<div class="control-sidebar-bg"></div>
</div>
<script src="/static/assets/kendoui-2015.2.624/js/kendo.web.min.js"></script>
<script src="/static/assets/select2-3.5.2/select2.js"></script>
<script src="/static/assets/intro/intro.js?version={{.today}}"></script>
<script src="/static/assets/jquery.zeroclipboard/jquery.zeroclipboard.min.js"></script>
<script>
    var source = "qcloud";
    var newUser = "";
</script>
<script src="/static/js/app.index.js?version={{.today}}"></script>
<script>
    $(document).ready(function() {
        /**
         * @todo 复制运维人员
         * @author qingzhou@2015-11-09
         */
        $("body")
            .on("copy", ".copy-btn", function(/* ClipboardEvent */ e) {
                e.clipboardData.clearData();
                e.clipboardData.setData("text/plain", $(this).prev().val());
                e.preventDefault();
            })
            .on('aftercopy','.copy-btn',function (e){
                var setDefault=$(this).get(0);
                if(e.success['text/plain']===true){
                    var d = dialog({
                        quickClose: true,/*点击空白处快速关闭*/
                        width: 150,
                        align:"top",
                        padding:6,
                        content: '<div class="c-dialogdiv2"><i class="c-dialogimg-success"></i>复制成功</div>'
                    });
                }else{
                    var d = dialog({
                        quickClose: true,/* 点击空白处快速关闭*/
                        width: 150,
                        align:"top",
                        padding:6,
                        content: '<div class="c-dialogdiv2"><i class="c-dialogimg-failure"></i>复制失败</div>'
                    });
                }
                d.show(setDefault);
                setTimeout(function() {
                    d.close().remove();
                }, 1500);

            })
    });
</script>    <div class="none video-content">
        <div class="content">
            <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" id="video-close"></span>
            <video  id="video" class="video-js vjs-default-skin" controls preload="none" width="800" height="600"
                    poster="/static/product/blueking/img/course/video.jpg"
                    data-setup="{}">
                <source src="/static/product/blueking/resource/cc.mp4" type='video/mp4' />
            </video>
        </div>
    </div>
    <div class="none video-content1">
        <div class="content">
            <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" id="video-close1"></span>
            <video  id="video1" class="video-js vjs-default-skin" controls preload="none" width="800" height="600"
                    poster="/static/product/blueking/img/course/cc_remove.jpg"
                    data-setup="{}">
                <source src="/static/product/blueking/resource/cc_remove.mp4" type='video/mp4' />
            </video>
        </div>
    </div>
    <div class="none video-content2">
        <div class="content">
            <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" id="video-close2"></span>
            <video  id="video2" class="video-js vjs-default-skin" controls preload="none" width="800" height="600"
                    poster="/static/product/blueking/img/course/cc_put.jpg"
                    data-setup="{}">
                <source src="/static/product/blueking/resource/cc_put.mp4" type='video/mp4' />
            </video>
        </div>
    </div>
    <div class="none video-content3">
        <div class="content">
            <span class="glyphicon glyphicon-remove-circle" aria-hidden="true" id="video-close3"></span>
            <video  id="video3" class="video-js vjs-default-skin" controls preload="none" width="800" height="600"
                    poster="/static/product/blueking/img/course/cc_mobile.jpg"
                    data-setup="{}">
                <source src="/static/product/blueking/resource/cc_mobile.mp4" type='video/mp4' />
            </video>
        </div>
    </div>
    <div class="control-sidebar-bg"></div>
    </div>
    <link href="/static/assets/video/video-js.css" rel="stylesheet" type="text/css">
    <script src="/static/assets/video/video.js"></script>
    </script>
    <script src="/static/js/common.js?version={{.today}}"></script>
    <!-- 项目需要引用的js文件 -->
    <script type='text/javascript'>

        $(document).ready(function(){
            $('.optgroup').click(function(){
                if($(this).next("li[class!='optgroup']").length >0){
                    return;
                }
                var company_id = $(this).attr('comid');
                var company_code = $(this).attr('comcode');
                var company_name = $(this).find('a span').text();
                console.log(company_name);
                var postdata = {company_id:company_id,company_code:company_code,company_name:company_name};
                $.ajax({
                    url: "/welcome/setDefaultCom",
                    type: "POST",
                    data:postdata,
                    dataType: "json",
                    success: function (response) {
                        window.location.reload();
                    }
                });
            })
            videojs.options.flash.swf = "http://staticcc.o.qcloud.com/static/assets/video/video-js.swf";

            
                        $('.defaultApp').click(function(){
                var appId=$(this).attr('value');
                var defaultappId = cookie.get('defaultAppId');
                if(appId == defaultappId){
                    return;
                }
                $.ajax({
                    url: "/welcome/setDefaultApp?ApplicationID="+appId,
                    type: "POST",
                    dataType: "json",
                    success: function (response) {
//                        var setDefaultApp=$('#chooseBusiness').get(0);
//                        var diaCopyMsg = dialog({
//                            quickClose: true,// 点击空白处快速关闭
//                            align:'bottom',
//                            padding:10,
//                            width:160,
//                            content: '<p style="color:#fff;text-align:center; margin:0;">'+response.message+'</p>',
//                            skin: 'c-Popuplayer-success'
//                        });
//                        diaCopyMsg.show(setDefaultApp);
//                        setTimeout(function () {
//                            diaCopyMsg.close().remove();
//                        }, 1500);
//
                        if(response.success){
                            setTimeout(function () {
                                window.location.reload();
                            }, 500);
                        }

                        return true;
                    }
                });
            });
                    });
    </script>
{{end}}